﻿using BeautyTech.Services.Catalogs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace BeautyTech.WebSite.Controllers
{
    public class CartController : Controller
    {

        #region Fields

        private readonly ProductService _productService;

        #endregion

        #region Ctor

        public CartController(ProductService productService)
        {
            this._productService = productService;
        }

        #endregion

        //
        // GET: /Cart/

        public ActionResult Index()
        {
            return View();
        }

        [HttpPost]
       // [ValidateInput(false)]
        public ActionResult AddProductToCart_Details(int productId, int shoppingCartTypeId, FormCollection form)
        {
            var product = _productService.GetProductById(productId);
            if (product == null)
            {
                return Json(new
                {
                    redirect = Url.RouteUrl("HomePage"),
                });
            }

            

            return View();
        }
       

    }
}
